package com.qys.livesMall.shortVideo.controller.app;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.framework.utils.SecurityUtils;
import com.qys.livesMall.framework.view.BaseQuery;
import com.qys.livesMall.shortVideo.model.vo.app.AppUserVideoHistoryVO;
import com.qys.livesMall.shortVideo.service.ShortVideoHistoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户浏览视频历史记录 前端控制器
 * </p>
 *
 * @author
 * @since 2023-05-30
 */
@RestController
@RequestMapping("/app/short/video/history")
@Tag(name = "用户短视频浏览历史记录")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AppShortVideoHistoryController {

    private final ShortVideoHistoryService shortVideoHistoryService;

    @PostMapping("/page")
    @Operation(summary = "分页查询用户短视频浏览记录")
    public R<Page<AppUserVideoHistoryVO>> page(@RequestBody BaseQuery baseQuery) {
        baseQuery.setId(String.valueOf(SecurityUtils.getUserId()));
        return R.ok(shortVideoHistoryService.page(baseQuery));
    }
}
